home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Advisor / CD-ROM Advisor.iso / prodemo / demo / pdymain.dir / 00001.ls next >
Encoding:
Text File  |  1995-09-29  |  2.9 KB  |  86 lines

  1. on startMovie
  2.   global gNumberOfMainButtons, gCentersOfMainButtons, gMagicOffsetsOfMainButtons, gCastMemsOfMainButtons, gAniHasBeenViewed, gRadiusOfMainButton, gMagicH1, gMagicH2, gMagicV1, gMagicV2, gAnisForMainButtons, gNumberOfSmallButtons, gCentersOfSmallButtons, gMagicOffsetsOfSmallButtons, gCastMemsOfSmallButtons, gLabelsForSmallButtonActions, gRadiusOfSmallButtons, gIndexOfCurrentButton, gMouseDownInButton, gSmallButtonsOn, gIsMainButton, gIsSmallButton, gChannelForHighLights, gChannelForFreeFlash, gFreeFlashTimerBase, gNextLabel, gMovieToPlay, gCursorIsHand
  3.   set gCursorIsHand to 0
  4.   set gChannelForHighLights to 4
  5.   set the puppet of sprite gChannelForHighLights to 1
  6.   set the visible of sprite gChannelForHighLights to 0
  7.   set gChannelForFreeFlash to 3
  8.   set the puppet of sprite gChannelForFreeFlash to 1
  9.   set the visible of sprite gChannelForFreeFlash to 0
  10.   set gIndexOfCurrentButton to 0
  11.   set gMouseDownInButton to 0
  12.   set gIsMainButton to 0
  13.   set gIsSmallButton to 0
  14.   set gMovieToPlay to 0
  15.   cursor(-1)
  16.   set gFreeFlashTimerBase to the timer
  17. end
  18.  
  19. on isPositionWithinMainButton hPos, vPos
  20.   global gMagicH1, gMagicH2, gMagicV1, gMagicV2
  21.   set indexOfButton to 0
  22.   if hPos < gMagicH1 then
  23.     if vPos < gMagicV1 then
  24.       if isWithinThisMainButton(2, hPos, vPos) then
  25.         set indexOfButton to 2
  26.       end if
  27.     else
  28.       if isWithinThisMainButton(1, hPos, vPos) then
  29.         set indexOfButton to 1
  30.       end if
  31.     end if
  32.   else
  33.     if vPos < gMagicV1 then
  34.       if hPos < gMagicH2 then
  35.         if isWithinThisMainButton(3, hPos, vPos) then
  36.           set indexOfButton to 3
  37.         end if
  38.       else
  39.         if isWithinThisMainButton(4, hPos, vPos) then
  40.           set indexOfButton to 4
  41.         end if
  42.       end if
  43.     else
  44.       if isWithinThisMainButton(5, hPos, vPos) then
  45.         set indexOfButton to 5
  46.       end if
  47.     end if
  48.   end if
  49.   return indexOfButton
  50. end
  51.  
  52. on isWithinThisMainButton index, h, v
  53.   global gCentersOfMainButtons, gRadiusOfMainButton
  54.   set centerTemp to getAt(gCentersOfMainButtons, index)
  55.   set hComp to getAt(centerTemp, 1) - h
  56.   set vComp to getAt(centerTemp, 2) - v
  57.   set r to sqrt((hComp * hComp) + (vComp * vComp)) < gRadiusOfMainButton
  58.   return r
  59. end
  60.  
  61. on isPositionWithinSmallButton hPos, vPos
  62.   global gMagicH1, gMagicH2, gMagicV1, gMagicV2
  63.   set indexOfButton to 0
  64.   if vPos > gMagicV2 then
  65.     if hPos < gMagicH1 then
  66.       if isWithinThisSmallButton(1, hPos, vPos) then
  67.         set indexOfButton to 1
  68.       end if
  69.     else
  70.       if isWithinThisSmallButton(2, hPos, vPos) then
  71.         set indexOfButton to 2
  72.       end if
  73.     end if
  74.   end if
  75.   return indexOfButton
  76. end
  77.  
  78. on isWithinThisSmallButton index, h, v
  79.   global gCentersOfSmallButtons, gRadiusOfSmallButtons
  80.   set centerTemp to getAt(gCentersOfSmallButtons, index)
  81.   set hComp to getAt(centerTemp, 1) - h
  82.   set vComp to getAt(centerTemp, 2) - v
  83.   set r to sqrt((hComp * hComp) + (vComp * vComp)) < gRadiusOfSmallButtons
  84.   return r
  85. end
  86.